Skip to content

feat: add anchor-evm crate for EVM-based anchoring#742

Merged
smrz2001 merged 5 commits into
mainfrom
feat/self-anchoring
Nov 26, 2025
Merged

feat: add anchor-evm crate for EVM-based anchoring#742
smrz2001 merged 5 commits into
mainfrom
feat/self-anchoring

Conversation

@smrz2001

@smrz2001 smrz2001 commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

Add new crate implementing EVM blockchain anchoring for Ceramic streams.

  • Supports self-anchoring directly to EVM chains without Merkle trees
  • Implements gas management with dynamic pricing and retry logic
  • Uses environment variables for RPC endpoints to avoid hardcoded secrets
  • Includes comprehensive tests for Gnosis Chain integration

@smrz2001 smrz2001 self-assigned this Oct 8, 2025
@smrz2001 smrz2001 marked this pull request as ready for review November 19, 2025 13:35
@smrz2001 smrz2001 requested a review from a team as a code owner November 19, 2025 13:36
@smrz2001 smrz2001 requested review from sam701 and removed request for a team November 19, 2025 13:36
Comment thread anchor-evm/src/evm_transaction_manager.rs
Comment thread anchor-evm/src/evm_transaction_manager.rs Outdated
Comment thread anchor-evm/src/contract.rs Outdated
Comment thread anchor-evm/src/proof_builder.rs
Comment thread anchor-evm/src/proof_builder.rs Outdated
Comment thread anchor-evm/src/evm_transaction_manager.rs Outdated
Comment thread anchor-evm/src/evm_transaction_manager.rs Outdated
Comment thread anchor-evm/src/evm_transaction_manager.rs
Comment thread anchor-evm/src/gnosis_test.rs Outdated
Comment thread anchor-evm/src/evm_transaction_manager.rs Outdated
Add new crate implementing EVM blockchain anchoring for Ceramic streams.
- Supports self-anchoring directly to EVM chains without Merkle trees
- Implements gas management with dynamic pricing and retry logic
- Uses environment variables for RPC endpoints to avoid hardcoded secrets
- Includes comprehensive tests for Gnosis Chain integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
smrz2001 added a commit that referenced this pull request Nov 25, 2025
…test

Fixes from PR #742 review:
- Fix tx_hash_to_cid: wrap hash with Keccak256 code + ETH_TX codec (0x93)
  instead of re-hashing with SHA2-256
- Fix AnchorProof parameter order: (chain_id, root, tx_hash, tx_type)
- Add chain ID validation after connecting to provider
- Implement retry logic with exponential backoff
- Add wallet balance logging for gas cost tracking
- Update default confirmations from 1 to 4 (matching JS implementation)

Code cleanup:
- Remove unused GasConfig (alloy handles gas estimation automatically)
- Remove unused get_root_block function and getRootBlock interface
- Consolidate gnosis_test.rs into integration_test.rs

Testing:
- Add test_cid_to_bytes32_matches_js to verify JS compatibility
- Add test_tx_hash_to_cid_matches_js to verify JS compatibility
- Add test_anchor_service_with_evm for full AnchorService flow testing
  (merkle tree building, EVM anchoring, time event creation)

Documentation:
- Update README with comprehensive test documentation
- Document all environment variables for integration tests
- Update contract interface to match actual implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@smrz2001 smrz2001 force-pushed the feat/self-anchoring branch from 56b8598 to 54e2ac2 Compare November 25, 2025 16:28
smrz2001 added a commit that referenced this pull request Nov 25, 2025
…test

Fixes from PR #742 review:
- Fix tx_hash_to_cid: wrap hash with Keccak256 code + ETH_TX codec (0x93)
  instead of re-hashing with SHA2-256
- Fix AnchorProof parameter order: (chain_id, root, tx_hash, tx_type)
- Add chain ID validation after connecting to provider
- Implement retry logic with exponential backoff
- Add wallet balance logging for gas cost tracking
- Update default confirmations from 1 to 4 (matching JS implementation)

Code cleanup:
- Remove unused GasConfig (alloy handles gas estimation automatically)
- Remove unused get_root_block function and getRootBlock interface
- Consolidate gnosis_test.rs into integration_test.rs

Testing:
- Add test_cid_to_bytes32_matches_js to verify JS compatibility
- Add test_tx_hash_to_cid_matches_js to verify JS compatibility
- Add test_anchor_service_with_evm for full AnchorService flow testing
  (merkle tree building, EVM anchoring, time event creation)

Documentation:
- Update README with comprehensive test documentation
- Document all environment variables for integration tests
- Update contract interface to match actual implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@smrz2001 smrz2001 force-pushed the feat/self-anchoring branch from 54e2ac2 to 1680ec7 Compare November 25, 2025 17:19
smrz2001 added a commit that referenced this pull request Nov 25, 2025
…test

Fixes from PR #742 review:
- Fix tx_hash_to_cid: wrap hash with Keccak256 code + ETH_TX codec (0x93)
  instead of re-hashing with SHA2-256
- Fix AnchorProof parameter order: (chain_id, root, tx_hash, tx_type)
- Add chain ID validation after connecting to provider
- Implement retry logic with exponential backoff
- Add wallet balance logging for gas cost tracking
- Update default confirmations from 1 to 4 (matching JS implementation)

Code cleanup:
- Remove unused GasConfig (alloy handles gas estimation automatically)
- Remove unused get_root_block function and getRootBlock interface
- Consolidate gnosis_test.rs into integration_test.rs

Testing:
- Add test_cid_to_bytes32_matches_js to verify JS compatibility
- Add test_tx_hash_to_cid_matches_js to verify JS compatibility
- Add test_anchor_service_with_evm for full AnchorService flow testing
  (merkle tree building, EVM anchoring, time event creation)

Documentation:
- Update README with comprehensive test documentation
- Document all environment variables for integration tests
- Update contract interface to match actual implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@smrz2001 smrz2001 force-pushed the feat/self-anchoring branch from 1680ec7 to 7a4235e Compare November 25, 2025 17:38
…test

Fixes from PR #742 review:
- Fix tx_hash_to_cid: wrap hash with Keccak256 code + ETH_TX codec (0x93)
  instead of re-hashing with SHA2-256
- Fix AnchorProof parameter order: (chain_id, root, tx_hash, tx_type)
- Add chain ID validation after connecting to provider
- Implement retry logic with exponential backoff
- Add wallet balance logging for gas cost tracking
- Update default confirmations from 1 to 4 (matching JS implementation)

Code cleanup:
- Remove unused GasConfig (alloy handles gas estimation automatically)
- Remove unused get_root_block function and getRootBlock interface
- Consolidate gnosis_test.rs into integration_test.rs

Testing:
- Add test_cid_to_bytes32_matches_js to verify JS compatibility
- Add test_tx_hash_to_cid_matches_js to verify JS compatibility
- Add test_anchor_service_with_evm for full AnchorService flow testing
  (merkle tree building, EVM anchoring, time event creation)

Documentation:
- Update README with comprehensive test documentation
- Document all environment variables for integration tests
- Update contract interface to match actual implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Check receipt.status() and return error if transaction reverted
- Use ok_or_else() instead of unwrap() for block_number

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

@stephhuynh18 stephhuynh18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one comment

Comment thread anchor-evm/src/evm_transaction_manager.rs Outdated
@smrz2001 smrz2001 added this pull request to the merge queue Nov 26, 2025
@smrz2001 smrz2001 removed this pull request from the merge queue due to a manual request Nov 26, 2025
@smrz2001 smrz2001 enabled auto-merge November 26, 2025 19:00
@smrz2001 smrz2001 added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main with commit 6a383ae Nov 26, 2025
20 checks passed
@smrz2001 smrz2001 deleted the feat/self-anchoring branch November 26, 2025 19:58
@smrz2001 smrz2001 mentioned this pull request Nov 26, 2025
/// Validate the configuration
pub fn validate_config(config: &EvmConfig) -> Result<()> {
if config.private_key.is_empty() {
return Err(anyhow!("Private key cannot be empty"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: anyhow::bail! is a bit nicer and equivalent

#[tokio::test]
#[ignore]
async fn test_evm_anchoring() -> Result<()> {
tracing_subscriber::fmt()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use #[test_log::test(tokio)] to automatically set up tracing and use those macros instead of println!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants